﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>地产评估系统（登录页面）</title>
    <link href="WEB/css/base.css" rel="stylesheet" />
    <link href="WEB/css/login/login.css" rel="stylesheet" />
    <link href="easyui/easyui/1.3.4/themes/default/easyui.css" rel="stylesheet" />
    <link href="easyui/easyui/1.3.4/themes/icon.css" rel="stylesheet" />
    <link href="easyui/easyui/1.3.4/demo/demo.css" rel="stylesheet" />
</head>
<body class="white">
    <div class="login-hd">
        <div class="left-bg"></div>
        <div class="right-bg"></div>
        <div class="hd-inner">
            <span class="logo">
                <img src="WEB/images/login_logo1.png" />
            </span>
        </div>
    </div>
    <div class="login-bd">
        <div class="bd-inner">
            <div class="inner-wrap">
                <div class="lg-zone">
                    <div class="lg-box">
                        <div class="lg-label">
                            <h4>用户登录</h4>
                        </div>
                        <form>
                            <div class="lg-username input-item clearfix">
                                <i class="iconfont">&#xe60d;</i>
                                <input type="text" id="name" placeholder="请输入用户名">
                            </div>
                            <div class="lg-password input-item clearfix">
                                <i class="iconfont">&#xe634;</i>
                                <input type="password" id="pwd" placeholder="请输入密码">
                            </div>
                            <div class="lg-check clearfix">
                                <div class="input-item">
                                    <i class="iconfont">&#xe633;</i>
                                    <input type="text" id="yzm" placeholder="请输入验证码">
                                </div>
                                <span class="check-code">
                                    <img style="height: 45px; width: 115px;" id="GetImg" onclick="ShowCodeImg()">
                                    <a id="kanbuq" href=" ">看不清，换一张</a>
                                </span>
                            </div>
                            <div class="enter">
                                <a class="purchaser" style="margin-left: 150px; width: 100px; height: 50px; border-radius: 5px; text-align: center" id="logindo">登录</a>
                            </div>
                        </form>
                        <div class="line line-y"></div>
                        <div class="line line-g"></div>
                    </div>
                </div>
                <div class="lg-poster"></div>
            </div>
        </div>
    </div>
    <div class="login-ft">
        <div class="ft-inner">
            <div class="about-us">
                <a href="javascript:;">关于我们</a>
                <a href="javascript:;">法律声明</a>
                <a href="javascript:;">服务条款</a>
                <a href="javascript:;">联系方式</a>
            </div>
            <div class="address">地址：北京市海淀区软件园&nbsp;邮编：10000&nbsp;&nbsp;Copyright&nbsp;©&nbsp;2016&nbsp;-&nbsp;2017&nbsp;uimaker-专注于ui设计&nbsp;版权所有</div>
            <div class="other-info">建议使用IE8及以上版本浏览器&nbsp;京ICP备&nbsp;09003078号&nbsp;E-mail：admin@uimaker.com</div>
        </div>
    </div>
    <script src="WEB/js/jquery-1.7.2-min.js"></script>
    <script src="jquery-easyui-1.5.2/Common.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.min.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
    <script src="jquery-easyui-1.5.2/jquery.params.js"></script>
    <script>
        //生成验证码
        var LoginCode = "";
        ShowCodeImg();
        function ShowCodeImg() {
            $.ajax({
                type: "get",
                url: WebApiURL + "api/values/?t=" + (new Date()).getTime(),
                dataType: "json",
                success: function (data, status) {
                    if (status == "success") {
                        LoginCode = data.code;
                        $("#GetImg").attr("src", "data:image/Jpeg;base64," + data.imgByte);
                    }
                }
            })
        }
        //登陆 
        $("#logindo").on("click", function () {
            var name = $("#name").val();
            var pwd = $("#pwd").val();
            var yzm = $("#yzm").val();
            var name1 = "";
            var pwd1 = "";
            if (name == "" || name == null || pwd == "" || pwd == null) {
                $.messager.alert("提示", "请输入用户名或密码");
                return;
            }
            if (yzm == "" || yzm == null) {
                $.messager.alert("提示", "请输入验证码");
                return;
            }
            $.ajax({
                type: "get",
                url: WebApiURL + "api/values/Get/?name=" + name + "&password=" + pwd + "&yzm=" + yzm + "&LoginCode=" + LoginCode,
                success: function (data) {
                    data = eval(data);
                    name1 = data.Users_Account;
                    pwd1 = data.Users_Pwd;
                    if (data == 1) {
                        $.messager.alert("", '验证码输入有误!');
                        return;
                    }
                    if (name == name1 && pwd == pwd1) {
                        $.messager.alert("提示", "登陆成功");
                        setTimeout("", 1000);
                        location.href = "Index.aspx?name=" + name + "&roleid=" + data.Roles_id;
                    }
                    else {
                        $.messager.alert("提示", "登陆失败");
                        location.href = "Login.aspx";
                    }
                }
            })
        })
    </script>
</body>
</html>
